﻿#include "UEditPoint.h"

UEditPoint::UEditPoint(CBaseNode *pNode, QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	connect(ui.pushButton_Save, &QPushButton::clicked, this, &UEditPoint::slot_Save);
	connect(ui.pushButton_Cancel, &QPushButton::clicked, this, &UEditPoint::slot_Cancel);
	rootNode = pNode;
	ui.treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);  // 禁用编辑
	ui.treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); // 支持 Ctrl 和 Shift 多选
	ui.treeView->header()->hide();
	model = new QStandardItemModel(this);
	//model->setHorizontalHeaderLabels(QStringList() << A2T("煤场管理"));
	ui.treeView->setModel(model);
	ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu);
	ui.treeView->viewport()->installEventFilter(this);
	model->appendRow(rootNode->cloneRecursive()->getItem());
}

UEditPoint::~UEditPoint()
{
}

void UEditPoint::slot_Save()
{
}

void UEditPoint::slot_Cancel()
{
	hide();
}
